<template>
  <div class="container" @touchmove.prevent @click="closeToast">
    <img class="award-pic" @click="goIndex" :src="activeImg.url" alt>
    <img class="close" src="../assets/images/newyearshop/close.png" alt>
  </div>
</template>
<script>
export default {
  data() {
    return {
      imgList: [
        // { url: require("../assets/images/newyearshop/toast.png") },
        // { url: require("../assets/images/newyearshop/toast1.png") },
        // { url: require("../assets/images/newyearshop/toast1.png") },
        // { url: require("../assets/images/newyearshop/ruler.png") },
        // { url: require("../assets/images/newyearshop/toast.png") }
      ],
      activeImg: "",
      isFlag: true
    };
  },
  props: ["value", "personValue"],
  created() {
    this.addImgUrl();
    this.isFlag = true;
    this.activeImg = this.imgList[this.value];
  },
  methods: {
    closeToast() {
      this.isFlag = false;
      this.$emit("listen-to-clild-event", false);
    },
    goIndex() {
      window.location.href = `/NewActivity/index/user_id/${this.personValue.user_id}/token/${this.personValue.token}/uuid/${this.personValue.uuid}`;

      // window.location.href = `/NewActivity/index/user_id/${this.user_id}/token/${this.user_id}/uuid/${this.uuid}`;
      // window.location.href = "/Fashion/index";
    },
    addImgUrl() {
      var baseUrl =
        window.location.host == "a.taojiji.com"
          ? "https://tjjstatic.taojiji.com/wapsite/default/newactivity/newYearShop/"
          : "http://tjjstatic.shan666.com/wapsite/default/newactivity/newYearShop/";
      this.imgList = [
        {url: baseUrl + "img/toast.png"},
        {url: baseUrl + "img/toast1.png"},
        {url: baseUrl + "img/toast2.png"},
        {url: baseUrl + "img/ruler.png"},
      ]
    }
  }
};
</script>
<style lang='less' scoped>
.container {
  position: fixed;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  .award-pic {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    margin: auto;
    width: 4.5rem;
    z-index: 999;
  }
  .close {
    position: absolute;
    right: 0.8rem;
    top: 3rem;
    width: 0.7rem;
  }
}
</style>